<template lang="">
    <div>
        <!-- 表格 -->
        <Table1 ref="multipleTable" :tableData="tableData" :tableCols="tableCols" :isEdit="false" @deleteUser="del">
            <template v-if="scope.data.resume!=null" slot="slot_resume" slot-scope="scope">
                {{scope.data.resume.name}}
            </template>
            <template v-if="scope.data.post!=null" slot="slot_post" slot-scope="scope">
                {{scope.data.post.name}}
            </template>
            <template v-if="scope.data.company!=null" slot="slot_company" slot-scope="scope">
                {{scope.data.company.name}}
            </template>
            <template v-if="scope.data.status!=null" slot="slot_status" slot-scope="scope">
                <!--0待查看|1已查看|2有意向|3不合适-->
                <el-tag v-if="scope.data.status == 0">待查看</el-tag>
                <el-tag type="success" v-if="scope.data.status == 1">已查看</el-tag>
                <el-tag type="warning" v-if="scope.data.status == 2">有意向</el-tag>
                <el-tag type="danger" v-if="scope.data.status == 3">不合适</el-tag>
            </template>
        </Table1>
        <div style="margin-top: 20px">
            <!-- 分页组件 -->
            <Page1 :pages="pages" :total="total" @handleCurrentChange="handleCurrentChange"></Page1>

        </div>

    </div>
</template>
<script>
    import Table1 from "@/components/Table1";
    import Page1 from "@/components/Page1";
    import local from "@/store/local.js";

    export default {
        name: "project",
        components: {

            Table1,
            Page1,

        },
        data() {
            return {

                // 表格
                total: 0,
                pages: 1,
                currentPage: 1,
                size: 10,
                tableData: [],

                tableCols: [{
                        prop: 'id',
                        label: 'ID',
                        width: 80
                    },
                    {
                        prop: 'post_id',
                        label: '职位',
                        slot: 'slot_post'
                    },
                    {
                        prop: 'company_id',
                        label: '公司',
                        slot: 'slot_company'
                    },
                    {
                        prop: 'resume_id',
                        label: '简历名称',
                        slot: 'slot_resume'
                    },
                    {
                        prop: 'status',
                        label: '状态',
                        slot: 'slot_status'
                    },
                    {
                        prop: 'send_date',
                        label: '投递日期'
                    },
                ],


            };
        },



        created() {},
        mounted() {

            this.list();
            //赋值

        },
        methods: {
            //获取简历
            getResume(param) {
                this.postRequest("/resume/queryPage", {
                    param
                }).then(res => {
                    if (res) {
                        let arr = [];
                        res.data.forEach((item) => {
                            let param = {
                                value: item.id,
                                label: item.name,
                            };
                            arr.push(param)
                        });
                        this.paramItems[0].options = arr
                    }
                    console.log(this.paramItems[0], " 简历");
                })
            },

            //初始化培训经历
            list(param) {
                this.postRequest("/send/queryPageStu?currentPage=" + this.currentPage, {
                    param
                }).then((res) => {
                    console.log(res, "分页查询的数据");
                    this.tableData = res.data;
                    this.total = res.total;
                    this.pages = res.pages;

                });

            },
            // 当前页改变
            handleCurrentChange(page) {
                this.currentPage = page;
                this.list();
            },

            // 查询
            search() {

                this.postRequest("/project/page", this.searchForm).then((res) => {
                    if (res) {
                        console.log(res, "搜索后的数据");
                        this.tableData = res.data;
                    }
                });
            },
            //关闭弹出框
            close() {

                this.drawer.visible = false;
            },


            // 删除
            del() {
                console.log(this.$refs["multipleTable"].data, "删除事件");
                let data = this.$refs["multipleTable"].data;
                console.log("删除", data);
                this.$confirm(
                        "此操作将删除投递记录：[" + data.id + "], 是否继续?",
                        "提示", {
                            confirmButtonText: "确定",
                            cancelButtonText: "取消",
                            type: "warning",
                        }
                    )
                    .then(() => {
                        this.deleteRequest("/send/" + data.id).then((res) => {
                            if (res) {
                                console.log(res, "删除=======");
                                this.$message.success(res.message);
                                this.list();
                            }
                        });
                    })
                    .catch(() => {
                        this.$message({
                            type: "info",
                            message: "已取消删除",
                        });
                    });
            },
        },
    };
</script>
<style lang=""></style>